package com.zhang.product.controller;


import com.zhang.common.domain.Product;
import com.zhang.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/api/v1/product")
public class ProductController {
    @Autowired
    private ProductService productService;
    @RequestMapping(
            value = "/getproduct/{id}",
            method = RequestMethod.GET)
    public Product getProductById(@PathVariable("id") Integer id){
        log.info("查询商品id为：{}",id);
        return productService.getProductById(id);
    }

}
